﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using UsersDAL;
using MODEL;

namespace DAL
{
    public class BloodTypeDAL
    {
        private BloodType ToBloodType(DataRow row)
        {
            BloodType model = new BloodType();
            model.Id = (System.Int32)sqlHelper.GetToDbvalue(row["Id"]);
            model.Bloodtype = (System.String)sqlHelper.GetToDbvalue(row["BloodType"]);
            return model;
        }
        public BloodType[] GetAll()
        {
            DataTable table = sqlHelper.ExecuteDataTable("select *from BloodType");
            BloodType[] models = new BloodType[table.Rows.Count];
            for (int i = 0; i < table.Rows.Count; i++)
            {
                DataRow row = table.Rows[i];
                models[i] = ToBloodType(row);
            }
            return models;
        }
    }
}
